import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class armstrong {
    public static void main (String[] args) throws IOException{
        if (args.length<1) throw new RuntimeException ("not enough arguments");
        if (args.length>1) throw new RuntimeException ("too many arguments");
        BufferedReader reader = new BufferedReader (new FileReader (new File (args[0])));
        String line;
        while ((line = reader.readLine()) != null){          
           int n = Integer.parseInt(line);
           int digits = line.length();
           int sum = 0;
           for (int i = 0;i<line.length();i++){
               sum = sum + (int)(Math.pow(Character.getNumericValue(line.charAt(i)),digits));
           }
           if (sum == n) System.out.println ("True");
           else System.out.println("False");
        }
    }
}